package com.fbinggun.dt.task.conditions;

import com.fbinggun.dt.task.Task;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerMoveEvent;

import java.sql.SQLException;

public class SneakingMove extends Conditions{

    public SneakingMove(String id, ConfigurationSection config, Task task) {
        super(id, config, task);
    }

    @EventHandler
    public void move(PlayerMoveEvent event) throws SQLException, ClassNotFoundException {
        if(!event.getPlayer().isSneaking()){
            return;
        }
        if(isRun(event.getPlayer())){

            addCount(event.getPlayer(),event.getFrom().distance(event.getTo()));
        }
    }
}
